from fastapi import APIRouter, Depends
from app.db.crud.menu_crud import get_menu
from app.db.crud import get_db
from sqlalchemy.orm import Session
from typing import Optional, Union
from app.common.response_code import resp_200, resp_400
from app.common.security import check_jwt_token


# 实例化API路由，需注册到主路由上去
menuAdminAPI = APIRouter(dependencies=[Depends(check_jwt_token)])


# 角色查询API
@menuAdminAPI.get("/getmenu", summary="获取菜单信息接口")
async def getMenu(db: Session = Depends(get_db)):
    return resp_200(get_menu(db))
